3.2.42 \(\int \frac {\tanh (c+d x)}{a+b \text {sech}^2(c+d x)} \, dx\) [142]

Optimal. Leaf size=23 \[ \frac {\log \left (b+a \cosh ^2(c+d x)\right )}{2 a d} \]

[Out]

1/2*ln(b+a*cosh(d*x+c)^2)/a/d

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {4223, 266} \begin {gather*} \frac {\log \left (a \cosh ^2(c+d x)+b\right )}{2 a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Tanh[c + d*x]/(a + b*Sech[c + d*x]^2),x]

[Out]

Log[b + a*Cosh[c + d*x]^2]/(2*a*d)

Rule 266

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rule 4223

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Module[{ff =
 FreeFactors[Cos[e + f*x], x]}, Dist[-(f*ff^(m + n*p - 1))^(-1), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*
(ff*x)^n)^p/x^(m + n*p)), x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n] && IntegerQ[p]

Rubi steps

\begin {align*} \int \frac {\tanh (c+d x)}{a+b \text {sech}^2(c+d x)} \, dx &=\frac {\text {Subst}\left (\int \frac {x}{b+a x^2} \, dx,x,\cosh (c+d x)\right )}{d}\\ &=\frac {\log \left (b+a \cosh ^2(c+d x)\right )}{2 a d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.13, size = 26, normalized size = 1.13 \begin {gather*} \frac {\log (a+2 b+a \cosh (2 (c+d x)))}{2 a d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Tanh[c + d*x]/(a + b*Sech[c + d*x]^2),x]

[Out]

Log[a + 2*b + a*Cosh[2*(c + d*x)]]/(2*a*d)

________________________________________________________________________________________

Maple [A]
time = 1.05, size = 36, normalized size = 1.57

method result size
derivativedivides \(-\frac {-\frac {\ln \left (a +b \mathrm {sech}\left (d x +c \right )^{2}\right )}{2 a}+\frac {\ln \left (\mathrm {sech}\left (d x +c \right )\right )}{a}}{d}\) \(36\)
default \(-\frac {-\frac {\ln \left (a +b \mathrm {sech}\left (d x +c \right )^{2}\right )}{2 a}+\frac {\ln \left (\mathrm {sech}\left (d x +c \right )\right )}{a}}{d}\) \(36\)
risch \(-\frac {x}{a}-\frac {2 c}{a d}+\frac {\ln \left ({\mathrm e}^{4 d x +4 c}+\frac {2 \left (2 b +a \right ) {\mathrm e}^{2 d x +2 c}}{a}+1\right )}{2 a d}\) \(56\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(d*x+c)/(a+b*sech(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

-1/d*(-1/2/a*ln(a+b*sech(d*x+c)^2)+1/a*ln(sech(d*x+c)))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 51 vs. \(2 (21) = 42\).
time = 0.27, size = 51, normalized size = 2.22 \begin {gather*} \frac {d x + c}{a d} + \frac {\log \left (2 \, {\left (a + 2 \, b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + a e^{\left (-4 \, d x - 4 \, c\right )} + a\right )}{2 \, a d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)/(a+b*sech(d*x+c)^2),x, algorithm="maxima")

[Out]

(d*x + c)/(a*d) + 1/2*log(2*(a + 2*b)*e^(-2*d*x - 2*c) + a*e^(-4*d*x - 4*c) + a)/(a*d)

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 76 vs. \(2 (21) = 42\).
time = 0.38, size = 76, normalized size = 3.30 \begin {gather*} -\frac {2 \, d x - \log \left (\frac {2 \, {\left (a \cosh \left (d x + c\right )^{2} + a \sinh \left (d x + c\right )^{2} + a + 2 \, b\right )}}{\cosh \left (d x + c\right )^{2} - 2 \, \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + \sinh \left (d x + c\right )^{2}}\right )}{2 \, a d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)/(a+b*sech(d*x+c)^2),x, algorithm="fricas")

[Out]

-1/2*(2*d*x - log(2*(a*cosh(d*x + c)^2 + a*sinh(d*x + c)^2 + a + 2*b)/(cosh(d*x + c)^2 - 2*cosh(d*x + c)*sinh(
d*x + c) + sinh(d*x + c)^2)))/(a*d)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 114 vs. \(2 (17) = 34\).
time = 2.62, size = 114, normalized size = 4.96 \begin {gather*} \begin {cases} \frac {\tilde {\infty } x \tanh {\left (c \right )}}{\operatorname {sech}^{2}{\left (c \right )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x \tanh {\left (c \right )}}{a + b \operatorname {sech}^{2}{\left (c \right )}} & \text {for}\: d = 0 \\\frac {1}{2 b d \operatorname {sech}^{2}{\left (c + d x \right )}} & \text {for}\: a = 0 \\\frac {x - \frac {\log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{d}}{a} & \text {for}\: b = 0 \\\frac {x}{a} + \frac {\log {\left (- \sqrt {- \frac {a}{b}} + \operatorname {sech}{\left (c + d x \right )} \right )}}{2 a d} + \frac {\log {\left (\sqrt {- \frac {a}{b}} + \operatorname {sech}{\left (c + d x \right )} \right )}}{2 a d} - \frac {\log {\left (\tanh {\left (c + d x \right )} + 1 \right )}}{a d} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)/(a+b*sech(d*x+c)**2),x)

[Out]

Piecewise((zoo*x*tanh(c)/sech(c)**2, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (x*tanh(c)/(a + b*sech(c)**2), Eq(d, 0))
, (1/(2*b*d*sech(c + d*x)**2), Eq(a, 0)), ((x - log(tanh(c + d*x) + 1)/d)/a, Eq(b, 0)), (x/a + log(-sqrt(-a/b)
 + sech(c + d*x))/(2*a*d) + log(sqrt(-a/b) + sech(c + d*x))/(2*a*d) - log(tanh(c + d*x) + 1)/(a*d), True))

________________________________________________________________________________________

Giac [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: TypeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tanh(d*x+c)/(a+b*sech(d*x+c)^2),x, algorithm="giac")

[Out]

Exception raised: TypeError >> An error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Warning, need to choose a branch for the root of a polynomial with parameters. This might be wrong.The choi
ce was done

________________________________________________________________________________________

Mupad [B]
time = 0.35, size = 51, normalized size = 2.22 \begin {gather*} \frac {\ln \left (a+2\,a\,{\mathrm {e}}^{2\,c}\,{\mathrm {e}}^{2\,d\,x}+a\,{\mathrm {e}}^{4\,c}\,{\mathrm {e}}^{4\,d\,x}+4\,b\,{\mathrm {e}}^{2\,c}\,{\mathrm {e}}^{2\,d\,x}\right )-2\,d\,x}{2\,a\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tanh(c + d*x)/(a + b/cosh(c + d*x)^2),x)

[Out]

(log(a + 2*a*exp(2*c)*exp(2*d*x) + a*exp(4*c)*exp(4*d*x) + 4*b*exp(2*c)*exp(2*d*x)) - 2*d*x)/(2*a*d)

________________________________________________________________________________________